define(['app'],function(app){return {module: function($scope, $http, eventBusService, httpService, params, configService) {
	$scope.form.api_pk = params.api_pk;
	//字典规则
	$scope.form.fk_rule = 'c6dde4bedc104dc9afc66dad5dca9425';
	
	$scope.saveForm = function(){
		if($scope.formCheck()){		
			httpService.post(app.urls.api_update, $scope.form, function(data) {
				if ("0000" === data.code) {
					eventBusService.publish("content.page.reload",data.data);
					eventBusService.publish("modal.page.close",{});
				} else {
					alert(data.msg);
				}
			});
		}
	}
	var getInitData = function(){
		httpService.post(app.urls.api_select, $scope.form, function(data) {
			if ("0000" === data.code) {
				$scope.form = data.data[0];
				$scope.$apply();
			} else {
				alert(data.msg);
			}
		});
	}
	var init = function(){
		httpService.post(app.urls.dictionary_selectOne, $scope.form, function(data) {
			if ("0000" === data.code) {
				$scope.dicList = data.data;
				getInitData();
			} else {
				alert(data.msg);
			}
		});
		$scope.$apply();
	}
	init();
}}});